package com.threadlocal.interrupt;

public class test {

	public static void main(String[] args) throws InterruptedException {

		Runnable r = getTask();

		Thread t = new Thread(r);

		t.start();

		Thread.sleep(3000);

		t.interrupt();
	}

	private void testerrupt() {

		while (!Thread.interrupted()) {

		}
	}

	private static Runnable getTask() {

		return new Runnable() {

			public void run() {
				while (!Thread.interrupted()) {
					System.out.println("outer::"
							+ Thread.currentThread().isInterrupted());
					try {
						System.out.println("execute Thread.sleep() method...");
						Thread.sleep(200000);
					} catch (InterruptedException e) {
						System.out.println("execute interrupted exception...");
						Thread.currentThread().interrupt();
						System.out.println("inner::"
								+ Thread.currentThread().isInterrupted());
					}
				}

			}
		};
	}
}
